function [Q,R] = srt_divider(N,D)
    len_n = length(N);
    n = len_n-1;
    Q = zeros(1, n);
    R = N;
    for i = n:-1:1,
        R = [R(2:end) 0]; % R << 1
        if(R(1) == 0 && R(2) == 1)
            Q(n-i+1) = 1;
            [R, co] = add_sub(R,D,1); % R = R - D
        elseif(R(1) == 1 && R(2) == 0)
            Q(n-i+1) = -1;
            [R, t] = add_sub(R,D,0); %  % R = R + D
        else
            Q(n-i+1) = 0;
        end
    end
    
    if(N(1) ~= R(1))
        [R, t] = add_sub(R,D,0);
    end
end